package com.lby.springcloud.ddd.usercontext.north.local;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lby.springcloud.ddd.usercontext.domain.User;
import com.lby.springcloud.ddd.usercontext.domain.UserService;
import com.lby.springcloud.ddd.usercontext.south.port.publisher.UserPublisher;

@Service
public class UserAppService {

	@Autowired
	private UserService userService;
	@Autowired
	private UserPublisher userPublisher;
	
	public boolean login(String account, String passport) {
		User user = userService.login(account, passport);
		if(user != null) {
			userPublisher.publishUserLogin(user);
			return true;
		}
		return false;
	}
}
